﻿<Workspace
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:semi="clr-namespace:agree.semi;assembly=agree-sys"
  xmlns:tsdb="clr-namespace:agree.itsdb;assembly=agree-sys">

    <Workspace.DefaultDirectories>
        <StringItem>grammars</StringItem>
        <StringItem>grammars\erg</StringItem>
    </Workspace.DefaultDirectories>

    <MaxEntModel x:Name="the_maxent_model" Loader="{MaxEntModelLoader redwoods.mem}" />

    <ReppRootModule x:Name="ERG_repp"
                    Content="{ReadFile rpp/tokenizer.rpp}"
                    Calls="xml;ascii;lgt;quotes" />

    <PosTrigramModel x:Name="English_pos_trigram_hmm" Filename="grammars\erg-agree\english-pos.hmm" />

    <XamlLoadInstance x:Name="ERG_xli" Filename="configs\erg.xml" />

    <PathRef x:Name="ERG" Item="{x:Reference ERG_xli}" Path="RootElement.NameScope[ERG]" />

    <DuplicateLexIds x:Name="ERG_dup_lex_id"
                     EntryMgr="{PathRef {x:Reference ERG}, EntryMgr}"
                     Items="{ReadFileLines lkb/nogen-lex.set}" />

    <PredicateIndex x:Name="ERG_pred_idx"
                    Loader="{PredicateIndexLoader {PathRef {x:Reference ERG}, EntryMgr.Lexicon}, {x:Reference ERG_dup_lex_id}}" />

    <x:Array x:Name="_root_strict" Type="StartSymbol">
        <PathRef Item="{x:Reference ERG}" Path="EntryMgr.ParserStartSymbols[0]" />
    </x:Array>

    <!--<tsdb:TsdbDatabase x:Name="hike_tsdb" LoadDirectory="grammars\erg\tsdb\gold\hike" Uncompress="True" />-->

    <!--<TextFileLoader x:Name="hike_textfile_sentences" Filename="grammars\erg-agree\hike\hike-results-use.txt" SkipItems="0" TakeItems="30" />-->
    <StringCorpus x:Name="hike_textfile_sentences" Items="{TextFileLoader grammars\\erg-agree\\hike\\hike-results-use.txt, 0, 30}" />

    <StringCorpus x:Name="xaml_sentences">
        <!--<StringItem xml:space="preserve">    Here he    built a large hut    which was given to the scouts in 1923.</StringItem>-->
        <!--<StringItem>Follow the road past NUTEC and continue up Kvarvenveien, past the recreation area.</StringItem>-->
        <!--<StringItem>'Sun-filled', well-kept Mountain View.</StringItem>-->
        <!--<StringItem>It was 1923.</StringItem>-->
        <!--<StringItem>Do not throw away lit cigarettes.</StringItem>-->
        <!--<StringItem>I must and will eat fish.</StringItem>-->
        <!--<StringItem>I inspected and ate my dinner</StringItem>-->
        <!--<StringItem>We hold these truths to be self evident.</StringItem>-->
        <!--<StringItem>Don't get plastic surgery this week.</StringItem>-->
        <!--<StringItem>I want you to notice me.</StringItem>-->
        <!--<StringItem>This dog chased the cat.</StringItem>-->
        <!--<StringItem>The dog whose toy the cat bit barked.</StringItem>-->
        <!--<StringItem>He is one person who can use this type of medium.</StringItem>-->
        <!--<StringItem>He is one person who is able to use this type of medium perfectly.</StringItem>-->
        <!--<StringItem>Cats sleep.</StringItem>-->
        <!--<StringItem>The cat is sleeping.</StringItem>-->
        <StringItem>Be careful about using campfires in the forest and open pastures.</StringItem>
        <!--<StringItem>Many a cat sleeps.</StringItem>-->
        <!--<StringItem>Don't touch Kim's cats.</StringItem>-->
        <!--<StringItem>Kim left home, and Sandy too.</StringItem>-->
        <!--<StringItem>Kim drank the milk, or perhaps the juice.</StringItem>-->
        <!--<StringItem>They eventually reached the islands, and founded colonies on the islands in the northernmost part of the Aegean Sea.</StringItem>-->
        <!--<StringItem>Obsidian is a hard, vitreous volcanic rock, which could be fashioned into tools for cutting and stabbing.</StringItem>-->
        <!--<StringItem>The high quality of the seam on Milos ensured that the area remained popular with early travelers.</StringItem>-->
        <!--<StringItem>The distinctive, sculpted marble figures of the era are now being reproduced in vast quantities as souvenirs.</StringItem>-->
        <!--<StringItem>Their curiosity pushed them to build vessels that were strong enough to ford the open seas and reach these islands, marking the start of the long legacy of Mediterranean seafaring.</StringItem>-->
        <!--<StringItem>You may rest, camp and spend the night in Byfjellene.</StringItem>-->
        <!--<StringItem>Cyclists should be considerate of pedestrians.</StringItem>-->
        <!--<StringItem>Be considerate of wild and domestic animals and other hikers.</StringItem>-->
        <!--<StringItem>In the city mountains you can rest, set up camp and spend the night.</StringItem>-->
        <!--<StringItem>Use open campfires with caution.</StringItem>-->
        <!--<StringItem>Towards Solheimslien the path on the eastern ridge is followed.</StringItem>-->
        <!--<StringItem>I have nothing to give.</StringItem>-->
        <!--<StringItem>Suree has been composing a poem.</StringItem>-->
        <!--<StringItem>I'm eating durian.</StringItem>-->
    </StringCorpus>

    <Sequence x:Name="item_parse_to_chart">

        <Factory x:TypeArguments="ReppExecutor">
            <Setter Property="{x:Static P.ReppRoot}" Value="{x:Reference ERG_repp}" />
        </Factory>

        <Factory x:TypeArguments="PosTagger">
            <Setter Property="{x:Static P.PosTrigramModel}" Value="{x:Reference English_pos_trigram_hmm}" />
        </Factory>

        <Factory x:TypeArguments="MappingTokenBuilder">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
        </Factory>

        <VertexTaggerF />

        <Factory x:TypeArguments="TokenMapper">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <TokenMappingLatticeAdapterF />

        <Factory x:TypeArguments="MorphologyExecutor">
            <Setter Property="{x:Static P.Lexicon}" Value="{PathRef {x:Reference ERG}, EntryMgr.Lexicon}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference ERG}, QuickCheck}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <Factory x:TypeArguments="ChartDependenciesLoader">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig}" />
            <Setter Property="{x:Static P.Isometrics}" Value="{PathRef {x:Reference ERG}, Isometrics}" />
        </Factory>

        <Factory x:TypeArguments="VerifyCoverageLoader" />

        <Factory x:TypeArguments="LexicalFilterLatticeBuilder" />

        <Factory x:TypeArguments="LexicalFilterExecutor">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <ChartObjLatticeExtractorF />

        <Factory x:TypeArguments="ParseControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig.Parser.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference ERG}, EntryMgr.ParserStartSymbols}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference ERG}, QuickCheck}" />
        </Factory>

    </Sequence>

    <Sequence x:Name="item_parse_unpack_scored">

        <x:Reference Name="item_parse_to_chart" />

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <!--<Factory x:TypeArguments="ScorerLoader">
                <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            </Factory>-->

        <Factory x:TypeArguments="BatchScorer">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            <!--<Setter Property="TopN" Value="5" />-->
        </Factory>

        <Factory x:TypeArguments="DerivationFeatureExtractor" />

        <!--<Factory x:TypeArguments="semi:DerivationToMrs">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference ERG}, Vpm}"/>
        </Factory>-->

        <!--<Factory x:TypeArguments="semi:VpmReverse">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference ERG}, Vpm}"/>
        </Factory>-->

        <!--<Factory x:TypeArguments="DmrsExtractor">
                    <Setter Property="{x:Static P.MrsManager}" Value="{x:Reference ERG_mrsm}" />
                </Factory>-->
    </Sequence>

    <Sequence x:Name="batch_parse_to_chart">

        <x:Reference Name="hike_textfile_sentences" />
        <!--<x:Reference Name="xaml_sentences" />-->

        <x:Reference Name="item_parse_to_chart" />

    </Sequence>

    <Sequence x:Name="batch_parse_unpack_scored">

        <x:Reference Name="hike_textfile_sentences" />
        <!--<x:Reference Name="xaml_sentences" />-->

        <x:Reference Name="item_parse_unpack_scored" />

    </Sequence>

    <Sequence x:Name="gen_non_vpm">

        <x:Reference Name="item_parse_to_chart" />

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <!--<Factory x:TypeArguments="ScorerLoader">
                <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            </Factory>-->

        <Factory x:TypeArguments="BatchScorer">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            <Setter Property="TopN" Value="1" />
        </Factory>

        <!--<Factory x:TypeArguments="DmrsExtractor" />-->

        <Factory x:TypeArguments="ParseOutputToGenerationInput">
            <Setter Property="{x:Static P.Grammar}" Value="{x:Reference ERG}" />
        </Factory>

    </Sequence>

    <Sequence x:Name="gen_vpm">

        <x:Reference Name="item_parse_to_chart" />

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <!--<Factory x:TypeArguments="ScorerLoader">
                <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            </Factory>-->

        <Factory x:TypeArguments="BatchScorer">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            <Setter Property="TopN" Value="1" />
        </Factory>

        <Factory x:TypeArguments="semi:DerivationToMrs">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference ERG}, Vpm}"/>
        </Factory>

        <!--<Factory x:TypeArguments="DmrsExtractor" />-->

        <Factory x:TypeArguments="semi:VpmReverse">
            <Setter Property="{x:Static P.Grammar}" Value="{x:Reference ERG}" />
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference ERG}, Vpm}"/>
        </Factory>

        <Factory x:TypeArguments="GenerationInputMaker">
            <Setter Property="{x:Static P.MrsManager}" Value="{PathRef {x:Reference ERG}, MrsManager}"/>
        </Factory>

   </Sequence>

    <Sequence x:Name="gen_main">

        <!--<x:Reference Name="gen_non_vpm" />-->
        <x:Reference Name="gen_vpm" />

        <Factory x:TypeArguments="DetermineRelevantRules">
            <Setter Property="{x:Static P.RuleSet}" Value="{PathRef {x:Reference ERG}, EntryMgr.GeneratorRules}" />
            <Publisher Property="{x:Static P.GeneratorActiveRules}" />
            <!-- ('Publisher' functionality is not actually implemented yet) -->
        </Factory>

        <ForkJoin>
            <Factory x:TypeArguments="LookupPredLexicalEntries">
                <Setter Property="{x:Static P.PredicateIndex}" Value="{x:Reference ERG_pred_idx}" />
            </Factory>

            <Factory x:TypeArguments="ApplyTriggerRules">
                <Setter Property="{x:Static P.TriggerRuleMgr}" Value="{PathRef {x:Reference ERG_xli}, RootElement.NameScope[ERG_trm]}" />
            </Factory>
        </ForkJoin>

        <Factory x:TypeArguments="GenControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig.Generator.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference ERG}, EntryMgr.GeneratorStartSymbols}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference ERG}, QuickCheck}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <!--<Factory x:TypeArguments="BatchScorer">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            <Setter Property="TopN" Value="5" />
        </Factory>-->

        <!--<Factory x:TypeArguments="ClientTabularDisplay" />-->

    </Sequence>

    <Sequence x:Name="batch_gen">

        <x:Reference Name="hike_textfile_sentences" />
        <!--<x:Reference Name="xaml_sentences" />-->

        <x:Reference Name="gen_main" />

    </Sequence>

</Workspace>
